package cn.maidouya.dictionary.service.impl;
import cn.maidouya.basic.util.PageList;
import cn.maidouya.dictionary.domain.DictionaryDetail;
import cn.maidouya.dictionary.mapper.DictionaryDetailMapper;
import cn.maidouya.dictionary.query.DictionaryDetailQuery;
import cn.maidouya.dictionary.service.IDictionaryDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class DictionaryDetailServiceImpl implements IDictionaryDetailService {
    @Autowired
    private DictionaryDetailMapper dictionaryDetailMapper;
    @Override
    @Transactional
    public void add(DictionaryDetail dictionaryDetail) {
        dictionaryDetailMapper.add(dictionaryDetail);
    }

    @Override
    @Transactional
    public void del(Long id) {
        dictionaryDetailMapper.del(id);
    }

    @Override
    @Transactional
    public void update(DictionaryDetail dictionaryDetail) {
        dictionaryDetailMapper.update(dictionaryDetail);
    }

    @Override
    public DictionaryDetail finOne(Long id) {
        return dictionaryDetailMapper.finOne(id);
    }

    @Override
    public List<DictionaryDetail> finAll() {
        return dictionaryDetailMapper.finAll();
    }

    @Override
    public PageList<DictionaryDetail> findPage(DictionaryDetailQuery dictionaryDetailQuery) {
        Integer total = dictionaryDetailMapper.totalsCount(dictionaryDetailQuery);
        List<DictionaryDetail> list = dictionaryDetailMapper.findPage(dictionaryDetailQuery);
        PageList<DictionaryDetail> pageList = new PageList<DictionaryDetail>(total, list);
        return pageList;
    }
}
